// 导入 request 对象
import request from '../utils/request'

// 抽取方法 - 获取频道
const getChannels = () => {
  return request({
    url: '/v1_0/user/channels',
    method: 'get'
  })
}

// 抽取方法 - 获取频道文章
/* eslint-disable */
const getArticles = ({ timestamp, channel_id }) => {
  return request({
    // url: '/v1_1/articles',
    url: '/v1_0/articles',
    method: 'get',
    params: {
      with_top: 1,
      timestamp,
      channel_id
    }
  })
}
/* eslint-disable */

// 抽取方法 - 不感兴趣
const disLikeArtle = ({ target }) => {
  return request({
    url: '/v1_0/article/dislikes',
    method: 'post',
    data: {
      target
    }
  })
}

// 抽取方法 - 举报
const reportArticle = ({ target, type }) => {
  return request({
    url: '/v1_0/article/reports',
    method: 'post',
    data: {
      target,
      type
    }
  })
}

// 暴露出去
export { getChannels, getArticles, disLikeArtle, reportArticle }
